﻿<UserControl x:Class="NicoView.View.NicoViewRibbonControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:Fluent="clr-namespace:Fluent;assembly=Fluent"
             xmlns:System="clr-namespace:System;assembly=mscorlib"
             xmlns:vm="http://nicoviewviewmodel"
             xmlns:editor="clr-namespace:NicoView.View.Editor"
             xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
             xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions"
             xmlns:converter="clr-namespace:NicoView.View.Converter"
             mc:Ignorable="d" 
             DataContext="{Binding SettingConsoleViewModel,Mode=OneWay,Source={StaticResource locator}}"
             d:DesignHeight="300" d:DesignWidth="300">

    <UserControl.Resources>
        <ObjectDataProvider x:Key="writeModeEnum"       MethodName="GetValues" ObjectType="{x:Type System:Enum}">
            <ObjectDataProvider.MethodParameters>
                <x:Type TypeName="editor:NicoViewCommentWriteModeCode"/>
            </ObjectDataProvider.MethodParameters>
        </ObjectDataProvider>
        
        <converter:CommentWriteModeConverter x:Key="writeModeConverter"/>
    </UserControl.Resources>

    <Grid>

        <Fluent:Ribbon x:Name="MainRibbon" Loaded="MainRibbon_Loaded" IsMinimized="True">

            <Fluent:Ribbon.Resources>
                <DataTemplate x:Key="middleDataItemTemplate">


                    <TextBlock Text="{Binding Path=Name, Mode=OneWay}" />


                </DataTemplate>

            </Fluent:Ribbon.Resources>

            <Fluent:RibbonTabItem x:Name="ViewTab" Header="{Binding View, Source={StaticResource resources}}">
                <Fluent:RibbonGroupBox Header="{Binding Window, Mode=OneWay, Source={StaticResource resources}}">
                    <Fluent:ToggleButton   LargeIcon="..\Images\WindowTopmost.png"  ToolTip="{Binding DisplayTop, Mode=OneWay, Source={StaticResource resources}}"  Header="{Binding DisplayTop, Mode=OneWay, Source={StaticResource resources}}"   IsChecked="{Binding Topmost,Mode=TwoWay, Source={StaticResource settings}}" />
                </Fluent:RibbonGroupBox>
                <Fluent:RibbonGroupBox Header="{Binding Comment, Mode=OneWay, Source={StaticResource resources}}">
                    <Fluent:CheckBox x:Name="AnonymousViewButton" Header="{Binding AnonymousDisplay, Mode=OneWay, Source={StaticResource resources}}"   IsChecked="{Binding VisibleAnonymous}" />
                   
                    <Fluent:CheckBox x:Name="VisibleNicoUserNameButton"  Header="{Binding OnlyFixedHandleNameDisplay, Mode=OneWay, Source={StaticResource resources}}" IsChecked="{Binding VisibleCustomNameOnly}" />
                    <Fluent:CheckBox x:Name="ViewUserIconButton"  Header="{Binding UserIconDisplay, Mode=OneWay, Source={StaticResource resources}}" IsChecked="{Binding ViewUserIcon,Mode=TwoWay,Source={StaticResource settings}}"/>

                    <Fluent:CheckBox x:Name="ViewCommentArt" Header="{Binding VisibleCommentArtCommentSwitch,Mode=OneWay, Source={StaticResource resources}}" IsChecked="{Binding VisibleCommentArtComment}"  />
                    
                    <Fluent:ComboBox x:Name="CommentNgShareLevel"  IsEditable="False" ItemsSource="{Binding CommentNgShareLevels}" SelectedItem="{Binding CommentNgShareLevel}">
                        <Fluent:ComboBox.ItemTemplate>
                            <DataTemplate>
                                <TextBlock Text="{Binding Path=Description}"/>
                            </DataTemplate>
                        </Fluent:ComboBox.ItemTemplate>
                    </Fluent:ComboBox>
                </Fluent:RibbonGroupBox >

                <Fluent:RibbonGroupBox  Header="{Binding CommentEditor, Mode=OneWay, Source={StaticResource resources}}" >

                    <Fluent:Gallery   Name="CommentWriteModeGallery" 
                                      ScrollViewer.VerticalScrollBarVisibility="Auto"
                                      SelectedItem="{Binding CommentWriteMode, Source={StaticResource settings}}"
                                      
                                      Orientation="Vertical" ItemsSource="{Binding Mode=OneWay, Source={StaticResource writeModeEnum}}"
                                      >
                        
                        <Fluent:Gallery.ItemTemplate>
                            <DataTemplate>
                                <TextBlock Text="{Binding Converter={StaticResource writeModeConverter}}"/>
                            </DataTemplate>
                        </Fluent:Gallery.ItemTemplate>
                        
                        
                        
                    </Fluent:Gallery>
                    
                </Fluent:RibbonGroupBox>
            </Fluent:RibbonTabItem>



            <Fluent:RibbonTabItem x:Name="SpeechTab" Header="{Binding Reading, Mode=OneWay, Source={StaticResource resources}}"   >


                <Fluent:RibbonGroupBox Header="{Binding Switch, Mode=OneWay, Source={StaticResource resources}}" >
                    <Fluent:ToggleButton LargeIcon="..\Images\readButton.png" Header="{Binding Read, Mode=OneWay, Source={StaticResource resources}}"   IsChecked="{Binding SpeechEnable,Mode=TwoWay}" />
                    <Fluent:ToggleButton LargeIcon="..\Images\Pen.png" Header="{Binding Learn, Mode=OneWay, Source={StaticResource resources}}"  IsChecked="{Binding SpeechLearnEnable,Mode=TwoWay}"/>
                </Fluent:RibbonGroupBox>
                <Fluent:RibbonGroupBox >
                    
                    <Fluent:RibbonGroupBox.Header>
                        <Binding Mode="OneWay" Path="Voices" Source="{StaticResource resources}"/>
                    </Fluent:RibbonGroupBox.Header>

                    <Fluent:Gallery  ScrollViewer.VerticalScrollBarVisibility="Visible"  Name="SpeacherGallery"

                                      SelectedItem="{Binding CurrentSpeacherProvider}"
                                      ItemTemplate="{DynamicResource middleDataItemTemplate}"
                                      ItemsSource ="{Binding Providers}" Orientation="Vertical"
                                      >



                    </Fluent:Gallery>


                </Fluent:RibbonGroupBox>
                <Fluent:RibbonGroupBox Header="{Binding Settings, Mode=OneWay, Source={StaticResource resources}}">
                    <Fluent:Button Header="{Binding BouyomichanSettings, Mode=OneWay, Source={StaticResource resources}}"  Command="{Binding BouyomichanPathCommand}" DataContext="{Binding NicoViewBouyomichanViewModel, Mode=OneWay, Source={StaticResource locator}}"/>
                </Fluent:RibbonGroupBox>
            </Fluent:RibbonTabItem>

            <Fluent:RibbonTabItem  Header="{Binding Live, Mode=OneWay, Source={StaticResource resources}}" >
                <Fluent:RibbonGroupBox x:Name="BroadcastingTab" Header="{Binding Broadcasting, Mode=OneWay, Source={StaticResource resources}}"  >


                    <Fluent:Button LargeIcon="..\Images\denpakun.png" Header="{Binding Broadcast, Mode=OneWay, Source={StaticResource resources}}" DataContext="{Binding NicoViewBroadcastConsolViewModel, Mode=OneWay, Source={StaticResource locator}}" Command="{Binding ShowBroadcastConsoleCommand, Mode=OneWay}" >
                        <Fluent:Button.Style>
                            <Style TargetType="{x:Type Fluent:Button}">
                                <Style.Triggers>
                                    <DataTrigger Binding="{Binding IsBroadcasting}" Value="True">
                                        <Setter Property="Visibility" Value="Collapsed"/>
                                    </DataTrigger>
                                </Style.Triggers>
                            </Style>
                        </Fluent:Button.Style>
                    </Fluent:Button>

                    <Fluent:Button LargeIcon="..\Images\stop.png" Header="{Binding StopBroadcastMessage, Mode=OneWay, Source={StaticResource resources}}" DataContext="{Binding NicoViewBroadcastConsolViewModel, Mode=OneWay, Source={StaticResource locator}}" Command="{Binding StopBroadcastCommand, Mode=OneWay}"   >
                        <Fluent:Button.Style>
                            <Style TargetType="{x:Type Fluent:Button}">
                                <Style.Triggers>
                                    <DataTrigger Binding="{Binding IsBroadcasting}" Value="False">
                                        <Setter Property="Visibility" Value="Collapsed"/>
                                    </DataTrigger>
                                </Style.Triggers>
                            </Style>
                        </Fluent:Button.Style>

                    </Fluent:Button>
                    
                    <Fluent:ToggleButton LargeIcon="..\Images\next.png"  IsChecked="{Binding AutoCreateNextBroadcast}" Header="{Binding AutoCreateNextBroadcast, Mode=OneWay, Source={StaticResource resources}}" />
                    
                    
                    <!-- エンコーダがインストールされていなければ取得ボタンを表示 -->
                    <Fluent:Button LargeIcon="..\Images\thunder.png" DataContext="{Binding NiconicoLiveEncoderViewModel, Mode=OneWay, Source={StaticResource locator}}" Header="{Binding GetEncoder, Mode=OneWay, Source={StaticResource resources}}" Command="{Binding GetNiconicoLiveEncoderCommand, Mode=OneWay}" >
                        <Fluent:Button.Style>
                            <Style TargetType="{x:Type Fluent:Button}">
                                <Style.Triggers>
                                    <DataTrigger Binding="{Binding NiconicoLiveEncoderInstalled}" Value="True">
                                        <Setter Property="Visibility" Value="Collapsed"/>
                                    </DataTrigger>
                                </Style.Triggers>
                            </Style>
                        </Fluent:Button.Style>

                    </Fluent:Button>
                    
                    <!-- エンコーダがインストールされていない場合はエンコーダ使用設定ボタンを表示しない -->
                    <Fluent:ToggleButton LargeIcon="..\Images\thunder.png" IsChecked="{Binding UsingBroadcasatEncoder}" Header="{Binding UsingBroadcasatEncoder, Mode=OneWay, Source={StaticResource resources}}" >
                        <Fluent:ToggleButton.Style>
                            <Style TargetType="{x:Type Fluent:ToggleButton}">
                                <Style.Triggers>
                                    <DataTrigger Binding="{Binding NiconicoLiveEncoderViewModel.NiconicoLiveEncoderInstalled, Mode=OneWay, Source={StaticResource locator}}" Value="False">
                                        <Setter Property="Visibility" Value="Collapsed"/>
                                    </DataTrigger>
                                </Style.Triggers>
                            </Style>
                        </Fluent:ToggleButton.Style>

                    </Fluent:ToggleButton>
                </Fluent:RibbonGroupBox>
                <Fluent:RibbonGroupBox Header="{Binding Connection, Mode=OneWay, Source={StaticResource resources}}" >
                    <Fluent:CheckBox Header="{Binding NextFrameAutoConnectiuon, Mode=OneWay, Source={StaticResource resources}}" IsChecked="{Binding NextFrameAutoConnection}"/>
                    <Fluent:CheckBox Header="{Binding NextFrameAutoConnectionWithBrowser, Mode=OneWay, Source={StaticResource resources}}" IsEnabled="{Binding NextFrameAutoConnection,Mode=OneWay}" IsChecked="{Binding NextFrameAutoConnectionWithBrowser}"/>
                </Fluent:RibbonGroupBox>
                
            </Fluent:RibbonTabItem>

            <Fluent:RibbonTabItem Header="{Binding Manage, Mode=OneWay, Source={StaticResource resources}}" >
                <Fluent:RibbonGroupBox  Header="{Binding AccountManage, Mode=OneWay, Source={StaticResource resources}}">
                    <Fluent:Button LargeIcon="..\Images\ManageAccount.png" Header="{Binding AccountEntry_Update, Mode=OneWay, Source={StaticResource resources}}" Command="{Binding AuthSetCommand}"/>
                </Fluent:RibbonGroupBox>
                <Fluent:RibbonGroupBox Header="{Binding Comment, Mode=OneWay, Source={StaticResource resources}}">
                    <Fluent:CheckBox  Header="{Binding SendNGCommentAvoidance, Mode=OneWay, Source={StaticResource resources}}" IsChecked="{Binding NgAvoidance}" />
                    <Fluent:CheckBox  Header="{Binding FixedHandleNameAutoEntry, Mode=OneWay, Source={StaticResource resources}}" IsChecked="{Binding AtMarkNameToCustomName}" />
                </Fluent:RibbonGroupBox>


                <Fluent:RibbonGroupBox>
                    
                    <Fluent:RibbonGroupBox.Header>
                        <Binding Mode="OneWay" Path="UrlDispalayBrowser" Source="{StaticResource resources}"/>
                    </Fluent:RibbonGroupBox.Header>

                    <Fluent:Gallery   Name="UrlExecuteGallery" 
                                      ScrollViewer.VerticalScrollBarVisibility="Visible"
                                      SelectedItem="{Binding CurrentUrlExecuteBrowser}"
                                      ItemTemplate="{DynamicResource middleDataItemTemplate}"
                                      ItemsSource ="{Binding UrlExecuteBrowsers}" Orientation="Vertical"
                                      />
                </Fluent:RibbonGroupBox>
            </Fluent:RibbonTabItem>


        </Fluent:Ribbon>
    </Grid>
</UserControl>
